home *** CD-ROM | disk | FTP | other *** search
/ An Invitation to the Roland World of Music / Roland - An Invitation To The Roland World Of Music.bin / vb / mmsystem / vb_libs / mm_midi.txt < prev   
Text File  |  1995-04-23  |  12KB  |  229 lines

  1. ' **************************************************************************
  2. '
  3. '         Multimedia API Declares adapted from WINMMSYS.TXT
  4. '         in turn taken from MMSYSTEM.H
  5. '
  6. '         Copyright (c) 1990-1993, Microsoft Corp.  All rights reserved.
  7. '
  8. ' **************************************************************************
  9.  
  10.  
  11.  
  12. ' ***************************************************************************
  13.  
  14. '                     General constants and data types
  15.  
  16. ' ****************************************************************************/
  17.  
  18. '  general constants
  19. Global Const MAXPNAMELEN = 32           '  max product name length (including NULL)
  20. Global Const MAXERRORLENGTH = 128       '  max error text length (including NULL)
  21.  
  22. Type RECT   ' Same as Windows API
  23.     left As Integer
  24.     top As Integer
  25.     right As Integer
  26.     bottom As Integer
  27. End Type
  28.  
  29. '  MMTIME data structure
  30.  
  31. Type SMPTE
  32.     hour As String * 1          '  hours
  33.     min As String * 1           '  minutes
  34.     sec As String * 1           '  seconds
  35.     frame As String * 1         '  frames
  36.     fps As String * 1           '  frames per second
  37.     dummy As String * 1         '  pad
  38. End Type
  39.  
  40. Type MMTIME
  41.     wType As Integer        '  indicates the contents of units
  42.     units As Long           '  (msecs, samples, bytes)
  43.     SMPTEVal As SMPTE
  44.     songptrpos As Long      '  song pointer position
  45. End Type
  46.  
  47.  
  48. '  types for wType field in MMTIME struct
  49. Global Const TIME_MS = &H1              '  time in milliseconds
  50. Global Const TIME_SAMPLES = &H2         '  number of wave samples
  51. Global Const TIME_BYTES = &H4           '  current byte offset
  52. Global Const TIME_SMPTE = &H8           '  SMPTE time
  53. Global Const TIME_MIDI = &H10           '  MIDI time
  54.  
  55.  
  56. ' ***************************************************************************
  57.  
  58. '                          Manufacturer and product IDs
  59.     
  60. '     Used with wMid and wPid fields in WAVEOUTCAPS, WAVEINCAPS,
  61. '     MIDIOUTCAPS, MIDIINCAPS, AUXCAPS, JOYCAPS structures.
  62.  
  63. ' ****************************************************************************/
  64.  
  65. '  manufacturer IDs
  66. Global Const MM_MICROSOFT = 1                   '  Microsoft Corp.
  67.  
  68. '  product IDs
  69. Global Const MM_MIDI_MAPPER = 1                 '  MIDI Mapper
  70. Global Const MM_WAVE_MAPPER = 2                 '  Wave Mapper
  71. Global Const MM_SNDBLST_MIDIOUT = 3             '  Sound Blaster MIDI output port
  72. Global Const MM_SNDBLST_MIDIIN = 4              '  Sound Blaster MIDI input port
  73. Global Const MM_SNDBLST_SYNTH = 5               '  Sound Blaster internal synthesizer
  74. Global Const MM_SNDBLST_WAVEOUT = 6             '  Sound Blaster waveform output
  75. Global Const MM_SNDBLST_WAVEIN = 7              '  Sound Blaster waveform input
  76. Global Const MM_ADLIB = 9                       '  Ad Lib-compatible synthesizer
  77. Global Const MM_MPU401_MIDIOUT = 10             '  MPU401-compatible MIDI output port
  78. Global Const MM_MPU401_MIDIIN = 11              '  MPU401-compatible MIDI input port
  79. Global Const MM_PC_JOYSTICK = 12                '  Joystick adapter
  80.  
  81.  
  82. ' ***************************************************************************
  83.  
  84. '                     General MMSYSTEM support
  85.  
  86. ' ****************************************************************************/
  87.  
  88. Declare Function mmsystemGetVersion Lib "MMSYSTEM" () As Integer
  89. Declare Sub OutputDebugStr Lib "MMSYSTEM" (ByVal LPCSTR As String)
  90.  
  91.  
  92.  
  93. ' ***************************************************************************
  94.  
  95. '                             Sound support
  96.  
  97. ' ****************************************************************************/
  98.  
  99. Declare Function sndPlaySound Lib "MMSYSTEM" (ByVal lpszSoundName As String, ByVal uFlags As Integer) As Integer
  100.  
  101. '  flag values for wFlags parameter
  102. Global Const SND_SYNC = &H0                 '  play synchronously (default)
  103. Global Const SND_ASYNC = &H1                '  play asynchronously
  104. Global Const SND_NODEFAULT = &H2            '  don't use default sound
  105. Global Const SND_MEMORY = &H4               '  lpszSoundName points to a memory file
  106. Global Const SND_LOOP = &H8                 '  loop the sound until next sndPlaySound
  107. Global Const SND_NOSTOP = &H10              '  don't stop any currently playing sound
  108.  
  109.  
  110. ' ***************************************************************************
  111.  
  112. '                             MIDI audio support
  113.  
  114. ' ****************************************************************************/
  115.  
  116. '  MIDI error return values
  117. Global Const MIDIERR_UNPREPARED = (MIDIERR_BASE + 0)       '  header not prepared
  118. Global Const MIDIERR_STILLPLAYING = (MIDIERR_BASE + 1)     '  still something playing
  119. Global Const MIDIERR_NOMAP = (MIDIERR_BASE + 2)            '  no current map
  120. Global Const MIDIERR_NOTREADY = (MIDIERR_BASE + 3)         '  hardware is still busy
  121. Global Const MIDIERR_NODEVICE = (MIDIERR_BASE + 4)         '  port no longer connected
  122. Global Const MIDIERR_INVALIDSETUP = (MIDIERR_BASE + 5)     '  invalid setup
  123. Global Const MIDIERR_LASTERROR = (MIDIERR_BASE + 5)        '  last error in range
  124.  
  125. Global Const MIDIPATCHSIZE = 128
  126.  
  127. '  MIDI callback messages
  128. Global Const MIM_OPEN = MM_MIM_OPEN
  129. Global Const MIM_CLOSE = MM_MIM_CLOSE
  130. Global Const MIM_DATA = MM_MIM_DATA
  131. Global Const MIM_LONGDATA = MM_MIM_LONGDATA
  132. Global Const MIM_ERROR = MM_MIM_ERROR
  133. Global Const MIM_LONGERROR = MM_MIM_LONGERROR
  134. Global Const MOM_OPEN = MM_MOM_OPEN
  135. Global Const MOM_CLOSE = MM_MOM_CLOSE
  136. Global Const MOM_DONE = MM_MOM_DONE
  137.  
  138. '  device ID for MIDI mapper
  139. Global Const MIDIMAPPER = (-1)
  140. Global Const MIDI_MAPPER = (-1)
  141.  
  142. '  flags for wFlags parm of midiOutCachePatches(), midiOutCacheDrumPatches()
  143. Global Const MIDI_CACHE_ALL = 1
  144. Global Const MIDI_CACHE_BESTFIT = 2
  145. Global Const MIDI_CACHE_QUERY = 3
  146. Global Const MIDI_UNCACHE = 4
  147.  
  148. '  MIDI output device capabilities structure
  149. Type MIDIOUTCAPS
  150.     wMid As Integer                  '  manufacturer ID
  151.     wPid As Integer                  '  product ID
  152.     vDriverVersion As Integer        '  version of the driver
  153.     szPname As String * MAXPNAMELEN  '  product name (NULL terminated string)
  154.     wTechnology As Integer           '  type of device
  155.     wVoices As Integer               '  # of voices (internal synth only)
  156.     wNotes As Integer                '  max # of notes (internal synth only)
  157.     wChannelMask As Integer          '  channels used (internal synth only)
  158.     dwSupport As Long             '  functionality supported by driver
  159. End Type
  160.  
  161. '  flags for wTechnology field of MIDIOUTCAPS structure
  162. Global Const MOD_MIDIPORT = 1      '  output port
  163. Global Const MOD_SYNTH = 2         '  generic internal synth
  164. Global Const MOD_SQSYNTH = 3       '  square wave internal synth
  165. Global Const MOD_FMSYNTH = 4       '  FM internal synth
  166. Global Const MOD_MAPPER = 5        '  MIDI mapper
  167.  
  168. '  flags for dwSupport field of MIDIOUTCAPS structure
  169. Global Const MIDICAPS_VOLUME = &H1               '  supports volume control
  170. Global Const MIDICAPS_LRVOLUME = &H2             '  separate left-right volume control
  171. Global Const MIDICAPS_CACHE = &H4
  172.  
  173. '  MIDI output device capabilities structure
  174. Type MIDIINCAPS
  175.     wMid As Integer                  '  manufacturer ID
  176.     wPid As Integer                  '  product ID
  177.     vDriverVersion As Integer        '  version of the driver
  178.     szPname As String * MAXPNAMELEN  '  product name (NULL terminated string)
  179. End Type
  180.  
  181. '  MIDI data block header
  182. Type MIDIHDR
  183.     lpData As Long               '  pointer to locked data block
  184.     dwBufferLength As Long       '  length of data in data block
  185.     dwBytesRecorded As Long      '  used for input only
  186.     dwUser As Long               '  for client's use
  187.     dwFlags As Long              '  assorted flags (see defines)
  188.     midihdr_tag As Long          '  reserved for driver
  189.     reserved As Long             '  reserved for driver
  190. End Type
  191.  
  192. '  flags for dwFlags field of MIDIHDR structure
  193. Global Const MHDR_DONE = &H1                     '  done bit
  194. Global Const MHDR_PREPARED = &H2                 '  set if header prepared
  195. Global Const MHDR_INQUEUE = &H4                  '  reserved for driver
  196.  
  197. '  MIDI function prototypes
  198. Declare Function midiOutGetNumDevs Lib "MMSYSTEM" () As Integer
  199. Declare Function midiOutGetDevCaps Lib "MMSYSTEM" (ByVal udeviceid As Integer, lpCaps As MIDIOUTCAPS, ByVal uSize As Integer) As Integer
  200. Declare Function midiOutGetVolume Lib "MMSYSTEM" (ByVal udeviceid As Integer, lpdwvolume As Long) As Integer
  201. Declare Function midiOutSetVolume Lib "MMSYSTEM" (ByVal udeviceid As Integer, ByVal dwVolume As Long) As Integer
  202. Declare Function midiOutGetErrorText Lib "MMSYSTEM" (ByVal uError As Integer, ByVal lpText As String, ByVal uSize As Integer) As Integer
  203. Declare Function midiOutOpen Lib "MMSYSTEM" (lphMidiOut As Integer, ByVal udeviceid As Integer, ByVal dwCallback As Long, ByVal dwInstance As Long, ByVal dwFlags As Long) As Integer
  204. Declare Function midiOutClose Lib "MMSYSTEM" (ByVal hMidiOut As Integer) As Integer
  205. Declare Function midiOutPrepareHeader Lib "MMSYSTEM" (ByVal hMidiOut As Integer, lphMidiOut As MIDIHDR, ByVal uSize As Integer) As Integer
  206. Declare Function midiOutUnprepareHeader Lib "MMSYSTEM" (ByVal hMidiOut As Integer, lphMidiOut As MIDIHDR, ByVal uSize As Integer) As Integer
  207. Declare Function midiOutShortMsg Lib "MMSYSTEM" (ByVal hMidiOut As Integer, ByVal dwMsg As Long) As Integer
  208. Declare Function midiOutLongMsg Lib "MMSYSTEM" (ByVal hMidiOut As Integer, lphMidiOut As MIDIHDR, ByVal uSize As Integer) As Integer
  209. Declare Function midiOutReset Lib "MMSYSTEM" (ByVal hMidiOut As Integer) As Integer
  210. Declare Function midiOutCachePatches Lib "MMSYSTEM" (ByVal hMidiOut As Integer, ByVal uBank As Integer, ByVal PatchArray As Long, ByVal uFlags As Integer) As Integer
  211. Declare Function midiOutCacheDrumPatches Lib "MMSYSTEM" (ByVal hMidiOut As Integer, ByVal uPatch As Integer, lpwKeyArray As Integer, ByVal uFlags As Integer) As Integer
  212. Declare Function midiOutGetID Lib "MMSYSTEM" (ByVal hMidiOut As Integer, lpudeviceid As Integer) As Integer
  213. Declare Function midiOutMessage Lib "MMSYSTEM" (ByVal hMidiOut As Integer, ByVal uMessage As Integer, ByVal dw1 As Long, ByVal dw2 As Long) As Long
  214. Declare Function midiInGetNumDevs Lib "MMSYSTEM" () As Integer
  215. Declare Function midiInGetDevCaps Lib "MMSYSTEM" (ByVal udeviceid As Integer, lpCaps As MIDIINCAPS, ByVal uSize As Integer) As Integer
  216. Declare Function midiInGetErrorText Lib "MMSYSTEM" (ByVal uError As Integer, ByVal lpText As String, ByVal uSize As Integer) As Integer
  217. Declare Function midiInOpen Lib "MMSYSTEM" (lphMidiIn As Integer, ByVal udeviceid As Integer, ByVal dwCallback As Long, ByVal dwInstance As Long, ByVal dwFlags As Long) As Integer
  218. Declare Function midiInClose Lib "MMSYSTEM" (ByVal hMidiIn As Integer) As Integer
  219. Declare Function midiInPrepareHeader Lib "MMSYSTEM" (ByVal hMidiIn As Integer, lpMidiInHdr As MIDIHDR, ByVal uSize As Integer) As Integer
  220. Declare Function midiInUnprepareHeader Lib "MMSYSTEM" (ByVal hMidiIn As Integer, lpMidiInHdr As MIDIHDR, ByVal uSize As Integer) As Integer
  221. Declare Function midiInAddBuffer Lib "MMSYSTEM" (ByVal hMidiIn As Integer, lpMidiInHdr As MIDIHDR, ByVal uSize As Integer) As Integer
  222. Declare Function midiInStart Lib "MMSYSTEM" (ByVal hMidiIn As Integer) As Integer
  223. Declare Function midiInStop Lib "MMSYSTEM" (ByVal hMidiIn As Integer) As Integer
  224. Declare Function midiInReset Lib "MMSYSTEM" (ByVal hMidiIn As Integer) As Integer
  225. Declare Function midiInGetID Lib "MMSYSTEM" (ByVal hMidiIn As Integer, lpudeviceid As Integer) As Integer
  226. Declare Function midiInMessage Lib "MMSYSTEM" (ByVal hMidiIn As Integer, ByVal uMessage As Integer, ByVal dw1 As Long, ByVal dw2 As Long) As Long
  227.  
  228.  
  229.